package com.hooya.fa.eu.biz.controller;

import com.hooya.fa.eu.biz.service.StkCollectionService;
import com.hooya.fa.eu.biz.service.TradeRecordService;
import com.hooya.integrated.common.core.util.R;
import com.hooya.integrated.common.security.annotation.Inner;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;


/**
 * @Description 审计 stock list 数据
 * @Author : Zongz
 * @Copyright Copyright (c) 豪雅集团
 * @Create 2023/12/1
 * @Version 1.0.0
 */
@RestController
@RequiredArgsConstructor
@Tag(name = "审计数据")
@RequestMapping("/stk")
public class EuStockOrigCollectController {

    private final TradeRecordService tradeRecordService;

    private final StkCollectionService stkCollectionService;

    @GetMapping("/b2b/list")
    @Inner(value = false)
    @Operation(summary = "b2b【√】", description = "b2b")
    public R<Void> getB2bData(@RequestParam("startDate") String startDate,
                              @RequestParam("endDate") String endDate) {
        tradeRecordService.getB2bData(startDate, endDate);
        return R.ok();
    }

    @GetMapping("/b2c/list")
    @Inner(value = false)
    @Operation(summary = "b2c【√】", description = "b2c")
    public R<Void> getB2cData(@RequestParam("startDate") String startDate,
                              @RequestParam("endDate") String endDate) {
        tradeRecordService.getB2cData(startDate, endDate);
        return R.ok();
    }

    @GetMapping("/bs/list")
    @Inner(value = false)
    @Operation(summary = "bs【√】", description = "bs")
    public R<Void> getBsData(@RequestParam("startDate") String startDate,
                             @RequestParam("endDate") String endDate) {
        tradeRecordService.getBsData(startDate, endDate);
        return R.ok();
    }

    @GetMapping("/cg/list")
    @Inner(value = false)
    @Operation(summary = "cg【√】", description = "cg")
    public R<Void> getCgData(@RequestParam("startDate") String startDate,
                             @RequestParam("endDate") String endDate) {
        tradeRecordService.getCgData(startDate, endDate);
        return R.ok();
    }

    @GetMapping("/th/list")
    @Inner(value = false)
    @Operation(summary = "th【√】", description = "th")
    public R<Void> getThData(@RequestParam("startDate") String startDate,
                             @RequestParam("endDate") String endDate) {
        tradeRecordService.getThData(startDate, endDate);
        return R.ok();
    }

    @GetMapping("/zy/list")
    @Inner(value = false)
    @Operation(summary = "zy【√】", description = "zy")
    public R<Void> getZyData(@RequestParam("startDate") String startDate,
                             @RequestParam("endDate") String endDate) {
        tradeRecordService.getZyData(startDate, endDate);
        return R.ok();
    }

    @PostMapping("/collection")
    @Inner(value = false)
    @Operation(summary = "生成stk基础temp数据【√】", description = "生成stk基础temp数据")
    public R<Void> generatorCollectionData(@RequestParam("startDate") String startDate,
                                           @RequestParam("endDate") String endDate,
                                           @RequestParam("num") int num) {
        stkCollectionService.generatorCollectionData(startDate, endDate, num);
        return R.ok();
    }
}
